#pragma once

#include <QMainWindow>
#include <QPointer>

class QLabel;
class QPushButton;
class QHBoxLayout;
class QVBoxLayout;
class QMovie;

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    explicit MainWindow(QWidget* parent = nullptr);
    ~MainWindow() override;

private slots:
    void onOpen();
    void onRewind();
    void onPrev();
    void onNext();
    void onPlayPause();
    void onFaster();
    void onSlower();
    void onFrameChanged(int frameNumber);

private:
    void setupUi();
    void updateUiState();
    void jumpToFrame(int frame);

private:
    QPointer<QLabel> imageLabel;
    QPointer<QMovie> movie;

    QPointer<QPushButton> btnOpen;
    QPointer<QPushButton> btnRewind;
    QPointer<QPushButton> btnPrev;
    QPointer<QPushButton> btnNext;
    QPointer<QPushButton> btnSlower;
    QPointer<QPushButton> btnFaster;
    QPointer<QPushButton> btnPlayPause;

    double speedFactor = 1.0; // 1.0 normal

	void readConfig();
	void writeConfig();
    QString m_configPath = "./config.config";  //QCoreApplication::applicationDirPath() + 
	QString m_defaltFilePath;
};


